package com.ssy.lingxi.pay.repository.assetAccount;

import com.ssy.lingxi.pay.entity.assetAccount.MemberAssetAccount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 会员资金账户
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/7/21
 */
@Repository
public interface MemberAssetAccountRepository extends JpaRepository<MemberAssetAccount,Long>, JpaSpecificationExecutor<MemberAssetAccount> {
    List<MemberAssetAccount> findByMemberIdAndMemberRoleId(Long memberId, Long memberRoleId);

    List<MemberAssetAccount> findByMemberIdAndMemberRoleIdAndMemberLevelType(Long memberId, Long memberRoleId, Integer memberLevelType);

    MemberAssetAccount findFirstByMemberIdAndMemberRoleIdAndMemberLevelType(Long memberId, Long memberRoleId, Integer memberLevelType);

    List<MemberAssetAccount> findByMemberIdAndMemberRoleIdAndParentMemberIdAndParentMemberRoleId(Long memberId, Long memberRoleId, Long parentMemberId, Long parentMemberRoleId);

    MemberAssetAccount findFirstByMemberIdAndMemberRoleIdAndParentMemberIdAndParentMemberRoleId(Long memberId, Long memberRoleId, Long parentMemberId, Long parentMemberRoleId);
}
